package com.tianzeculture.stagebao.activity.home.adapter;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tianzeculture.stagebao.R;
import com.tianzeculture.stagebao.bean.TypeDetailListBean;

import java.util.List;

import static com.tianzeculture.stagebao.net.base.AppBaseRestUsageV2.PICTURE_URL;

/**
 * Created by Administrator on 2018/9/5.
 */

public class TypeDetailAdapter extends BaseQuickAdapter<TypeDetailListBean.TypeDetailBean, BaseViewHolder> {
    Context context;

    public TypeDetailAdapter(@LayoutRes int layoutResId, @Nullable List<TypeDetailListBean.TypeDetailBean> data, Context context) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, TypeDetailListBean.TypeDetailBean item) {
        ImageView imageView = helper.getView(R.id.iv_header);
        Glide.with(context).load(PICTURE_URL + item.getImgurl()).placeholder(R.mipmap.icon_head).override(300, 300).error(R.mipmap.icon_head).into(imageView);
        helper.setText(R.id.tv_name, item.getNickname());
        helper.setText(R.id.tv_money, "出场费: " + item.getPrice() + "/" + (item.getUnit() == null ? "小时" : item.getUnit()));
        helper.setText(R.id.tv_sex, "性别: " + (item.getSex().equals("1") ? "男" : "女") + "  年龄: " + item.getAge() + "    " + item.getParentName() + "-" + item.getName());
        helper.setText(R.id.tv_address, "".equals(item.getAddress()) ? "不限" : item.getAddress());
    }
}
